<template>
	<div class="operate">
		<div class="sec">
			<input
				type="text"
				:placeholder="'请输入' + placeholder + '名称/编码'"
				v-model="code"
			/><button class="iconfont" @click="setCode">
				&#xe634;
			</button>
		</div>
		<span class="senior" v-if="isSeniorShow">高级搜索</span>
		<el-row>
			<el-button plain v-show="isExportShow">导出</el-button>
			<el-button type="primary" v-if="isAddShow" @click="add"
				>新增</el-button
			>
		</el-row>
	</div>
</template>

<script>
export default {
	data: function () {
		return {
			code:''
		};
	},
	props: {
		isAddShow: {
			type: Boolean,
			default: true,
		},
		isSeniorShow: {
			type: Boolean,
			default: false,
		},
		isExportShow: {
			type: Boolean,
			default: true,
		},
		placeholder: {
			type: String,
			default: "类别",
		},
		add: {
			type: Function,
			default: () => {
				console.log("新增")
			},
		},
	},
	methods:{
		setCode(){
			this.$store.commit('common/setCode',this.code)
			this.$store.commit('common/isSetCode',!this.$store.state.common.setCode)
		}
	}
}
</script>

<style lang="scss" scoped>
@import "@/assets/css/goodsoperate.scss";
</style>
